package com.example.chat.controller;

import com.dragonsoftbravo.libs.Opr;
import com.example.chat.model.ro.AssetsRequestApprovalPassDistributeRO;
import com.example.chat.model.ro.AssetsRequestRecordRO;
import com.example.chat.repository.AssetsRequestRecordRepository;
import com.example.chat.service.AssetsApprovalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description
 * @Date 2022/11/18 1:16
 * @Author pq
 */
@RestController
@Api(value = "固资审批",tags = {"固资审批"})
@RequestMapping("/assetsApproval")
public class AssetsApprovalController extends BaseController{

    @Resource
    private AssetsApprovalService assetsApprovalService;

    @ApiOperation(value="通过当前固资申请单")
    @PostMapping("/passAssetsRequest")
    public ResponseEntity<Opr<Void>> passAssetsRequest(@Validated AssetsRequestApprovalPassDistributeRO ro, BindingResult br){
        validateFiled(br);
        String currentEmpId=currentUser();
        assetsApprovalService.passAssetsRequestByDistribute(ro,currentEmpId);
        return process(this::successResult);
    }
}
